﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 晨曦超市管理系统.查询
{
    public partial class ChaXunShang : Form
    {
        public ChaXunShang()
        {
            InitializeComponent();
        }

        private void ChaXunShang_Load(object sender, EventArgs e)
        {
           
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
        DataTable table;
        public void cha(string sqlstr)
        {
            try
            {
                Reusing.XianShi(dataGridView3, sqlstr,table);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string sqlstr = "select a.Salesman_Name,a.SalesDate,d.Name,a.memberName,b.ProductID,c.Name1,b.Quantity,b.AloneAmount from Sales a inner join SalesDetail b on a.Salesman_Name=b.Salesman_Name inner join CommodityList c on c.ProductID=b.ProductID inner join informationOfEmployees d on d.UserNameID=a.UserNameID  where a.Salesman_Name='" + textBox1.Text.Trim() + "'";
            cha(sqlstr);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string sqlstr = "select a.Salesman_Name,a.SalesDate,d.Name,a.memberName,b.ProductID,c.Name1,b.Quantity,b.AloneAmount from Sales a inner join SalesDetail b on a.Salesman_Name=b.Salesman_Name inner join CommodityList c on c.ProductID=b.ProductID inner join informationOfEmployees d on d.UserNameID=a.UserNameID";
            cha(sqlstr);
        }
    }
}
